﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace RealNumbers
{
    class Parse
    {
        public static bool Validate(string str)
        {
            //Regex regex1 = new Regex(@"\A[-]?(([0-9]+)(\.[0-9]+)?){1}?\Z");
            Regex regex1 = new Regex(@"\A[-]?(([1-9]+[0-9]*)(\.[0-9]+)?){1}?\Z");
            //Regex regex2 = new Regex(@"(\A[-]?((0)(\.[0-9]*[1-9]+[0-9]*)?)?\Z )");
            Regex regex2 = new Regex(@"\A[-]?(([0])(\.[0-9]+)?){1}?\Z");

            return regex1.IsMatch(str) || regex2.IsMatch(str);
        }
    }
}
